package com.parksys.controller;

import com.parksys.common.JsonResult;
import com.parksys.pojo.Discount;
import com.parksys.service.NewsService;
import com.parksys.util.JsonUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @auther longfei
 * @date 2020/9/15 20:14
 * @Version 1.0
 */
@RestController
@Api(tags = "关于消息的操作")
public class NewsController {
    @Autowired
    private NewsService newsService;
    @GetMapping("/findDiscount.do")
    @ApiOperation(value = "查询优惠", notes = "优惠券")
    public List<Discount> findAll () {
        List<Discount> list = newsService.findAll();

        return list;
    }
    @GetMapping("/deleteDiscount.do")
    @ApiOperation(value = "删除优惠", notes = "删除券")
    public JsonResult delete (Integer id) {
        newsService.delete(id);
        return JsonUtil.creatJsonResult(1, "删除成功");

    }

}
